Part Number Hot Search : 
OP491GS 8206BA4 1N6001 TSC407 OP491GS SI9140DQ L34H360 P1300
Product Description
Full Text Search
 

To Download W78E058B40PL Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  w78e58b/w78e058b data sheet 8-bit microcontroller publication release date: december 4, 2006 - 1 - revision a8 table of contents- 1. general des cription ............................................................................................................ ... 3 2. features ....................................................................................................................... ................ 3 3. pin config uration s ............................................................................................................. ..... 4 4. pin descri ption ................................................................................................................ .......... 5 5. functional d escription ......................................................................................................... 6 5.1 ram ............................................................................................................................ ........... 6 5.2 timers 0, 1 and 2.............................................................................................................. ..... 6 5.3 clock .......................................................................................................................... ............ 7 5.4 crystal o scillato r............................................................................................................. ....... 7 5.5 external clock................................................................................................................. ....... 7 5.6 power m anagement ............................................................................................................... 7 5.7 reduce emi em ission ........................................................................................................... 7 5.8 reset.......................................................................................................................... ............ 7 5.9 port 4 ......................................................................................................................... ............ 9 5.10 int2 / nt3 i ............................................................................................................................ 9 5.11 port 4 base addr ess regist ers ........................................................................................... 11 5.12 in-system programmi ng (isp) mode................................................................................... 13 5.13 in-system programming contro l register (chpco n) ....................................................... 15 5.14 f04kboot mode (boot from l drom) ............................................................................. 15 6. securi ty ....................................................................................................................... ............... 19 6.1 lock bit ....................................................................................................................... ......... 19 6.2 movc i nhibit ................................................................................................................... .... 19 6.3 encryption ..................................................................................................................... ....... 20 6.4 oscillator contro l ............................................................................................................. .... 20 7. electrical chara cteristi cs............................................................................................... 21 7.1 absolute maxi mum rati ngs ................................................................................................. 21 7.2 d.c. charac teristics........................................................................................................... .. 21 7.3 a.c. charac teristics ........................................................................................................... .. 23 7.3.1 clock input wavefo rm........................................................................................................... 23 7.3.2 program fetc h cycl e ............................................................................................................ 23 7.3.3 data read cycle................................................................................................................ ...24 7.3.4 data writ e cycl e ............................................................................................................... ....24 7.3.5 port acce ss cycl e.............................................................................................................. ...24
w78e58b/w78e058b - 2 - 8. timing w aveforms............................................................................................................... .... 25 8.1 program fetc h cycle ........................................................................................................... 2 5 8.2 data read cycle................................................................................................................ .. 25 8.3 data write cycle............................................................................................................... ... 26 8.4 port access cycle.............................................................................................................. .. 26 9. typical applicat ion circui ts .............................................................................................. 27 9.1 expanded external program memory and cr ystal .............................................................. 27 9.2 expanded external data me mory and osc illator ................................................................ 28 10. package dime nsio ns............................................................................................................. .. 29 10.1 40-pin dip ..................................................................................................................... ....... 29 10.2 44-pin plcc .................................................................................................................... .... 29 10.3 44-pin pqfp .................................................................................................................... .... 30 11. application notes.............................................................................................................. ..... 31 11.1 in-system programming software ex amples ...................................................................... 31 12. revision history............................................................................................................... ....... 36
w78e58b/w78e058b publication release date: december 4, 2006 - 3 - revision a8 1. general description the w78e058b is an 8-bit microcontroller which has an in-system programmable flash eprom for firmware updating. the instruction set of the w 78e058b is fully compatible with the standard 8052. the w78e058b contains a 32k bytes of main rom and a 4k bytes of auxiliary rom which allows the contents of the 32kb main rom to be updated by t he loader program located at the 4kb auxiliary rom; 512 bytes of on-chip ram; four 8-bit bi-d irectional and bit-addressable i/o ports; an additional 4-bit port p4; three 16-bit timer/counters; a seri al port. these peripherals are supported by a eight sources two-level interrupt capability. to facilit ate programming and verification, the rom inside the w78e058b allows the program memory to be progr ammed and read electronically. once the code is confirmed, the user can pr otect the code for security. the w78e058b microcontroller has two power r eduction modes, idle mode and power-down mode, both of which are software selectable. the idle m ode turns off the processor clock but allows for continued peripheral operation. the power-down mode stops the crystal oscillator for minimum power consumption. the external clo ck can be stopped at any time and in any state without affecting the processor. 2. features y fully static design 8-bit cmos microcontroller y 32k bytes of in-system programmable flas h eprom for application program (aprom) y 4k bytes of auxiliary rom for loader program (ldrom) y 512 bytes of on-chip ram (including 256 by tes of aux-ram, software selectable) y 64k bytes program memory address space and 64k bytes data memory address space y four 8-bit bi-directional ports y one 4-bit multipurpose programmable port y three 16-bit timer/counters y one full duplex serial port y eight-sources, two-level interrupt capability y built-in power management y code protection y packaged in ? lead free (rohs) dip 40: w78e058b40dl ? lead free (rohs) plcc 44: W78E058B40PL ? lead free (rohs) pqfp 44: w78e058b40fl
w78e58b/w78e058b - 4 - 3. pin configurations vdd 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 39 40 34 35 36 37 38 30 31 32 33 26 27 28 29 21 22 23 24 25 p0.0, ad0 p0.1, ad1 p0.2, ad2 p0.3, ad3 p0.4, ad4 p0.5, ad5 p0.6, ad6 p0.7, ad7 ea ale psen p2.5, a13 p2.6, a14 p2.7, a15 p2.0, a8 p2.1, a9 p2.2, a10 p2.3, a11 p2.4, a12 t2, p1.0 40-pin dip p1.2 p1.3 p1.4 p1.5 p1.6 rxd, p3.0 txd, p3.1 p1.7 rst int0, p3.2 int1, p3.3 t0, p3.4 t1, p3.5 wr, p3.6 rd, p3.7 xtal1 xtal2 vss t2ex, p1.1 44-pin plcc 44-pin qfp 40 2 1 44 43 42 41 6543 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 10 9 8 7 14 13 12 11 16 15 p1.5 p1.6 p1.7 rst rxd, p3.0 txd, p3.1 int0, p3.2 int1, p3.3 t0, p3.4 t1, p3.5 a d 3 , p 0 . 3 t 2 , p 1 . 0 p 1 . 2 v d d a d 2 , p 0 . 2 a d 1 , p 0 . 1 a d 0 , p 0 . 0 t 2 e x , p 1 . 1 p 1 . 3 p 1 . 4 x t a l 1 v s s p 2 . 4 , a 1 2 p 2 . 3 , a 1 1 p 2 . 2 , a 1 0 p 2 . 1 , a 9 p 2 . 0 , a 8 x t a l 2 p 3 . 7 , / r d p 3 . 6 , / w r p0.4, ad4 p0.5, ad5 p0.6, ad6 p0.7, ad7 ea ale psen p2.7, a15 p2.6, a14 p2.5, a13 p4.1 p 4 . 0 int2, p4.3 / i n t 3 , p 4 . 2 34 40 39 38 37 36 35 44 43 42 41 33 32 31 30 29 28 27 26 25 24 23 p0.4, ad4 p0.5, ad5 p0.6, ad6 p0.7, ad7 ea ale psen p2.7, a15 p2.6, a14 p2.5, a13 22 21 20 19 18 17 16 15 14 13 12 11 4 3 2 1 8 7 6 5 10 9 p1.5 p1.6 p1.7 rst rxd, p3.0 txd, p3.1 int0, p3.2 int1, p3.3 t0, p3.4 t1, p3.5 x t a l 1 v s s p 2 . 4 , a 1 2 p 2 . 3 , a 1 1 p 2 . 2 , a 1 0 p 2 . 1 , a 9 p 2 . 0 , a 8 x t a l 2 p 3 . 7 , / r d p 3 . 6 , / w r a d 3 , p 0 . 3 t 2 , p 1 . 0 p 1 . 2 v d d a d 2 , p 0 . 2 a d 1 , p 0 . 1 a d 0 , p 0 . 0 t 2 e x , p 1 . 1 p 1 . 3 p 1 . 4 p 4 . 0 / i n t 3 , p 4 . 2 p4.1 int2, p4.3
w78e58b/w78e058b publication release date: december 4, 2006 - 5 - revision a8 4. pin description symbol type descriptions e a i external access enable: this pin forces the processor to execute the external rom. the rom address and data will not be presented on the bus i f the e a pin is high. psen o h program store enable: psen enables the external rom data in the port 0 address/data bus. when internal rom access is performed, no psen strobe signal outputs originate from this pin. ale o h address l a tch enable: ale is used to enable the address latch that separates the address from the data on po rt 0. ale runs at 1/6th of the oscillator frequency. rst i l reset: a high on this pin for two machine cycles while the oscillator is running resets the device. xtal1 i crystal 1: this is the crystal oscilla tor input. this pin may be driven by an external clock. xtal2 o crystal 2: this is the crystal osc illator output. it is the inversion of xtal1. v ss i ground: ground potential. v dd i power supply: supply voltage for operation. p0.0 ? p0.7 i/o d port 0: function is the same as that of standard 8052. p1.0 ? p1.7 i/o h port 1: function is the same as that of standard 8052. p2.0 ? p2.7 i/o h port 2: port 2 is a bi-directional i/o por t with internal pull-ups. this port also provides the upper address bits for accesses to external memory. p3.0 ? p3.7 i/o h port 3: function is the same as that of the standard 8052. p4.0 ? p4.3 i/o h port 4: a bi-directional i/o. see details below. * note: type i: input, o: output, i/o: bi-directional, h: pull-high, l: pull-low, d: open drain
w78e58b/w78e058b - 6 - 5. functional description the w78e058b architecture consists of a core c ontroller surrounded by various registers, four general purpose i/o ports, one special pur pose programmable 4-bits i/o port, 512 bytes of ram, three timer/counters, a serial port. the processor suppor ts 111 different opcodes and references both a 64k program address space and a 64k data storage space. 5.1 ram the internal data ram in the w78e058b is 512 by tes. it is divided into two banks: 256 bytes of scratchpad ram and 256 bytes of aux-ram. thes e rams are addressed by different ways. y ram 0h ? 7fh can be addressed directly and indirectly as the same as in 8051. address pointers are r0 and r1 of the selected register bank. y ram 80h ? ffh can only be addressed indirectly as t he same as in 8051. address pointers are r0, r1 of the selected registers bank. y aux-ram 0h ? ffh is addressed indirectly as the sa me way to access external data memory with the movx instruction. address pointer ar e r0 and r1 of the selected register bank and dptr register. an access to external data me mory locations higher than ffh will be performed with the movx instruction in the same way as in the 8051. the aux-ram is disable after a reset. setting the bit 4 in chpcon register will enabl e the access to aux-ram. when aux-ram is enabled the instructions of "movx @ri" will alwa ys access to on-chip aux-ram. when executing from internal program memory, an access to aux-ram will not affect the ports p0, p2, wr and rd . example, chpenr reg f6h chpcon reg bfh mov chpenr, #87h mov chpenr, #59h orl chpcon, #00010000b ; enable aux-ram mov chpenr, #00h mov r0, #12h mov a, #34h movx @r0, a ; write 34h data to 12h address. 5.2 timers 0, 1 and 2 timers 0, 1, and 2 each consist of two 8-bit data r egisters. these are called tl0 and th0 for timer 0, tl1 and th1 for timer 1, and tl2 and th2 for time r 2. the tcon and tmod registers provide control functions for timers 0, 1. the t2con regist er provides control functions for timer 2. rcap2h and rcap2l are used as reload/capture registers for timer 2. the operations of timer 0 and timer 1 are the same as in the w78c51. timer 2 is a 16-bi t timer/counter that is configured and controlled by the t2con register. like timers 0 and 1, timer 2 c an operate as either an external event counter or as an internal timer, depending on the setting of bi t c/t2 in t2con. timer 2 has three operating modes: capture, auto-reload, and baud rate generator . the clock speed at capture or auto-reload mode is the same as that of timers 0 and 1.
w78e58b/w78e058b publication release date: december 4, 2006 - 7 - revision a8 5.3 clock the w78e058b is designed with either a crystal oscillato r or an external clock. internally, the clock is divided by two before it is used by default. this ma kes the w78e058b relatively insensitive to duty cycle variations in the clock. 5.4 crystal oscillator the w78e058b incorporates a built-in crystal oscillato r. to make the oscillator work, a crystal must be connected across pins xtal1 and xtal2. in addition, a load capacitor must be connected from each pin to ground. 5.5 external clock an external clock should be connected to pin xtal1. pin xtal2 should be left unconnected. the xtal1 input is a cmos-type input, as required by the crystal oscillator. 5.6 power management idle mode setting the idl bit in the pcon register enters the id le mode. in the idle mode, the internal clock to the processor is stopped. the peripherals and the interrupt logic continue to be clocked. the processor will exit idle mode when either an interrupt or a reset occurs. power-down mode when the pd bit in the pcon register is set, t he processor enters the power-down mode. in this mode all of the clocks are stopped, including the osc illator. to exit from power-down mode is by a hardware reset or external interrupts int0 to int1 when enabled and set to level triggered. 5.7 reduce emi emission the w78e058b allows user to diminish the gain of on-chip oscillator amplifier by using programmer to clear the b7 bit of security register. once b7 is set to 0, a half of gain will be decreased. care must be taken if user attempts to diminish the gain of osc illator amplifier, reducing a half of gain may affect the external crystal operating improperly at high frequency. the value of c1 and c2 may need some adjustment while running at lower gain. 5.8 reset the external reset signal is sampled at s5p2. to take effect, it must be held high for at least two machine cycles while the oscillator is running. an in ternal trigger circuit in the reset line is used to deglitch the reset line when the w78e058b is used wi th an external rc network. the reset logic also has a special glitch removal circuit that ignores g litches on the reset line. during reset, the ports are initialized to ffh, the stack pointer to 07h, pcon (w ith the exception of bit 4) to 00h, and all of the other sfr registers except sbu f to 00h. sbuf is not reset.
w78e58b/w78e058b - 8 - w78e058b special function registers (sfrs) and reset values f8 ff f0 +b 00000000 chpenr 00000000 f7 e8 ef e0 +acc 00000000 e7 d8 +p4 xxxx1111 df d0 +psw 00000000 d7 c8 +t2con 00000000 rcap2l 00000000 rcap2h 00000000 tl2 00000000 th2 00000000 cf c0 xicon 00000000 p4cona 00000000 p4conb 00000000 sfral 00000000 sfrah 00000000 sfrfd 00000000 sfrcn 00000000 c7 b8 +ip 00000000 chpcon 0xx00000 bf b0 +p3 00000000 p43al 00000000 p43ah 00000000 b7 a8 +ie 00000000 p42al 00000000 p42ah 00000000 p2econ 0000xx00 af a0 +p2 11111111 a7 98 +scon 00000000 sbuf xxxxxxxx 9f 90 +p1 11111111 p41al 00000000 p41ah 00000000 97 88 +tcon 00000000 tmod 00000000 tl0 00000000 tl1 00000000 th0 00000000 th1 00000000 8f 80 +p0 11111111 sp 00000111 dpl 00000000 dph 00000000 p40al 00000000 p40ah 00000000 pcon 00110000 87 notes: 1.the sfrs marked with a plus sign( +) are both byte- and bit-addressable. 2. the text of sfr with bold type char acters are extension function registers.
w78e58b/w78e058b publication release date: december 4, 2006 - 9 - revision a8 5.9 port 4 port 4, address d8h, is a 4-bit multipurpose programmable i/o port. each bit can be configured individually by software. the port 4 has four different operation modes. mode 0: p4.0 ? p4.3 is a bi-directional i/o port which is sa me as port 1. p4.2 and p4.3 also serve as external interrupt int3 and nt2 i if enabled. mode 1: p4.0 ? p4.3 are read strobe signals that are synchronized with rd signal at specified addresses. these signals can be used as chip -select signals for external peripherals. mode 2: p4.0 ? p4.3 are write strobe signals that are synchronized with wr signal at specified addresses. these signals can be used as chip -select signals for external peripherals. mode 3: p4.0 ? p4.3 are read/write strobe signal s that are synchronized with rd or wr signal at specified addresses. these signals can be us ed as chip-select signals for external peripherals. when port 4 is configured with the feature of ch ip-select signals, the chip-select signal address range depends on the contents of the sfr p4xah, p4xa l, p4cona and p4conb. the registers p4xah and p4xal contain the 16-bit base address of p4.x. the registers p4cona and p4conb contain the control bits to configure the port 4 operation mode. 5.10 int2 / nt3 i two additional external interrupts, int2 and int3 , whose functions are similar to those of external interrupt 0 and 1 in the standard 80c52. the functions/status of these interrupts are determined/shown by the bits in the xicon (external in terrupt control) register. the xicon register is bit-addressable but is not a standard register in the standard 80c52. its address is at 0c0h. to set/clear bits in the xicon register, one can use the "setb ( clr ) bit" instruction. for example, "setb 0c2h" sets the ex2 bit of xicon. xicon - external interrupt control (c0h) px3 ex3 ie3 it3 px2 ex2 ie2 it2 px3: external interrupt 3 priority high if set ex3: external interrupt 3 enable if set ie3: if it3 = 1, ie3 is set/cleared automatically by hardware when interrupt is detected/serviced it3: external interrupt 3 is falling-edge/low-level triggered when this bit is set/cleared by software px2: external interrupt 2 priority high if set ex2: external interrupt 2 enable if set ie2: if it2 = 1, ie2 is set/cleared automatically by hardware when interrupt is detected/serviced it2: external interrupt 2 is falling-edge/low-level triggered when this bit is set/cleared by software
w78e58b/w78e058b - 10 - eight-source interrupt information interrupt source vector address polling sequence within priority level enable required settings interrupt type edge/level external interrupt 0 03h 0 (highest) ie.0 tcon.0 timer/counter 0 0bh 1 ie.1 - external interrupt 1 13h 2 ie.2 tcon.2 timer/counter 1 1bh 3 ie.3 - serial port 23h 4 ie.4 - timer/counter 2 2bh 5 ie.5 - external interrupt 2 33h 6 xicon.2 xicon.0 external interrupt 3 3bh 7 (lowest) xicon.6 xicon.3 p4conb (c3h) bit name function 7, 6 p43fun1 p43fun0 00: mode 0. p4.3 is a general purpose i/o port which is the same as port1. 01: mode 1. p4.3 is a read strobe signal for chip select purpose. the address range depends on the sfr p43ah, p43al, p43cmp1 and p43cmp0. 10: mode 2. p4.3 is a write strobe signal for chip select purpose. the address range depends on the sfr p43ah, p43al, p43cmp1 and p43cmp0. 11: mode 3. p4.3 is a read/write strobe signal for chip select purpose. the address range depends on the sfr p 43ah, p43al, p43cmp1, and p43cmp0. 5, 4 p43cmp1 p43cmp0 chip-select signals address comparison: 00: compare the full address (16 bits length) with the base address register p43ah, p43al. 01: compare the 15 high bits (a15 ? a1) of address bus with the base address register p43ah, p43al. 10: compare the 14 high bits (a15 ? a 2) of address bus with the base address register p43ah, p43al. 11: compare the 8 high bits (a15 ? a8) of address bus with the base address register p43ah, p43al. 3, 2 p42fun1 p42fun0 the p4.2 function control bits which are the similar definition as p43fun1, p43fun0. 1, 0 p42cmp1 p42cmp0 the p4.2 address comparator length contro l bits which are the similar definition as p43cmp1, p43cmp0.
w78e58b/w78e058b publication release date: december 4, 2006 - 11 - revision a8 p4cona (c2h) bit name function 7, 6 p41fun1 p41fun0 the p4.1 function control bits which are the similar definition as p43fun1, p43fun0. 5, 4 p41cmp1 p41cmp0 the p4.1 address comparator length contro l bits which are the similar definition as p43cmp1, p43cmp0. 3, 2 p40fun1 p40fun0 the p4.0 function control bits which are the similar definition as p43fun1, p43fun0. 1, 0 p40cmp1 p40cmp0 the p4.0 address comparator length contro l bits which are the similar definition as p43cmp1, p43cmp0. p2econ (aeh) bit name function 7 p43csinv the active polarity of p4.3 when pin p4 .3 is defined as read and/or write strobe signal. 1: p4.3 is active high when pin p4.3 is defined as read and/or write strobe signal. 0: p4.3 is active low when pin p4.3 is defined as read and/or write strobe signal. 6 p42csinv the similarity definition as p43sinv. 5 p41csinv the similarity definition as p43sinv. 4 p40csinv the similarity definition as p43sinv. 3 - reserve 2 - reserve 1 - 0 0 - 0 5.11 port 4 base address registers p40ah, p40al the base address register for comparator of p4.0 . p40ah contains the high-order byte of address, p40al contains the low-order byte of address. p41ah, p41al the base address register for comparator of p4.1 . p41ah contains the high-order byte of address, p41al contains the low-order byte of address.
w78e58b/w78e058b - 12 - p42ah, p42al the base address register for comparator of p4.2 . p42ah contains the high-order byte of address, p42al contains the low-order byte of address. p43ah, p43al the base address register for comparator of p4.3 . p43ah contains the high-order byte of address, p43al contains the low-order byte of address. p4 (d8h) bit name function 7 - reserve 6 - reserve 5 - reserve 4 - reserve 3 p43 port 4 data bit which outputs to pin p4.3 at mode 0. 2 p42 port 4 data bit. which outputs to pin p4.2 at mode 0. 1 p41 port 4 data bit. which outputs to pin p4.1at mode 0. 0 p40 port 4 data bit which outputs to pin p4.0 at mode 0. here is an example to program the p4.0 as a write strobe signal at the i/o port address 1234h ? 1237h and positive polarity, and p4.1 ? p4.3 are used as general i/o ports. mov p40ah, #12h mov p40al, #34h ; base i/o address 1234h for p4.0 mov p4cona, #00001010b ; p4.0 a write strobe signal and address line a0 and a1 are masked. mov p4conb, #00h ; p4.1 ? p4.3 as general i/o port which are the same as port1 mov p2econ, #10h ; write the p40sinv = 1 to inverse the p4.0 write strobe polarity ; default is negative. then any instruction movx @dptr, a (with dptr = 1234h ? 1237h) will generate the positive polarity write strobe signal at pin p4.0. and the instru ction mov p4, #xx will output the bit3 to bit1 of data #xx to pin p4.3 ? p4.1.
w78e58b/w78e058b publication release date: december 4, 2006 - 13 - revision a8 address bus bit length selectable comparator register p4xal p4xah equal p4.x mux 4->1 p4 register p4.x read write data i/o rd_cs wr_cs rd/wr_cs p4xcmp0 p4xcmp1 p4xfun0 p4xfun1 p4xcsinv p4.x input data bus register pin 5.12 in-system programming (isp) mode the w78e058b equips one 32k byte of main rom bank for application program (called aprom) and one 4k byte of auxiliary rom bank for loader program (called ldrom). in the normal operation, the microcontroller executes the code in the aprom. if the content of aprom needs to be modified, the w78e058b allows user to activate the in-sys tem programming (isp) mode by setting the chpcon register. the chpcon is read-only by default, software must write two specific values 87h, then 59h sequentially to the chpenr register to enable the chpcon write attribute. writing chpenr register with the values except 87h and 59h will close chpcon register write attribute. the w78e058b achieves all in-system pr ogramming operations including enter/exit isp mode, program, erase, read ... etc, during device in the idle mode. setting the bit chpcon.0 the device will enter in-system programming mode afte r a wake-up from idle mode. because device needs proper time to complete the isp operations before awaken from idle mode, software may use timer interrupt to control the duration for device wa ke-up from idle mode. to perform isp operation for revising contents of aprom, software located at apr om setting the chpcon register then enter idle mode, after awaken from idle mode the device execut es the corresponding interrupt service routine in ldrom. because the device will clear the program counter while switching from aprom to ldrom, the first execution of reti instruct ion in interrupt service routine will jump to 00h at ldrom area. the device offers a software reset for switching back to aprom while the content of aprom has been updated completely. setting chpcon register bit 0, 1 and 7 to logic-1 will result a software reset to reset the cpu . the software reset serves as a external reset. this in-system programming feature makes the job easy and efficient in which the application needs to update firmware frequently. in some
w78e58b/w78e058b - 14 - applications, the in-system programming feature make it possible to easily update the system firmware without opening the chassis. sfrah, sfral: the objective address of on-chip rom in the in-system programming mode. sfrah contains the high-order byte of address, sfral contains the low-order byte of address. sfrfd: the programming data for on-chip rom in programming mode. sfrcn: the control byte of on-chip rom programming mode. sfrcn (c7) bit name function 7 - reserve. 6 wfwin on-chip rom bank select for in-system programming. 0: 32k bytes rom bank is selected as destination for re-programming. 1: 4k bytes rom bank is selected as destination for re-programming. 5 oen rom output enable. 4 cen rom chip enable. 3, 2, 1, 0 ctrl [3:0] the flash control signals mode wfwin ctrl<3:0> oe n cen sfrah, sfral sfrfd erase 32kb aprom 0 0010 1 0 x x program 32kb aprom 0 0001 1 0 address in data in read 32kb aprom 0 0000 0 0 address in data out erase 4kb ldrom 1 0010 1 0 x x program 4kb ldrom 1 0001 1 0 address in data in read 4kb ldrom 1 0000 0 0 address in data out
w78e58b/w78e058b publication release date: december 4, 2006 - 15 - revision a8 5.13 in-system programming control register (chpcon) chpcon (bfh) bit name function 7 swreset (f04kmode) when this bit is set to 1, and both fbootsl and fprogen are set to 1. it will enforce microcontroller reset to initial condition just like power on reset. this action will re-boot the microcontroller and start to normal operation. to read this bit in logic-1 can determine that the f04kboot mode is running. 6 - reserve. 5 - reserve. 4 enauxram 1: enable on-chip aux-ram. 0: disable the on-chip aux-ram 3 0 must set to 0. 2 0 must set to 0. 1 fbootsl the program location select. 0: the loader program locates at the 32 kb aprom. 4kb ldrom is destination for re-programming. 1: the loader program locates at t he 4 kb memory bank. 32kb aprom is destination for re-programming. 0 fprogen rom programming enable. 1: enable. the microcontroller enter the in-system programming mode after entering the idle mode and wake-up from interrupt. during in-system programming mode, the operation of er ase, program and read are achieve when device enters idle mode. 0: disable. the on-chip flash memory is read-only. in-sys tem programmability is disabled. 5.14 f04kboot mode (boot from ldrom) by default, the w78e058b boots from aprom program after a power on reset. on some occasions, user can force the w78e058b to boot from the ldrom program via following settings . the possible situation that you need to enter f04kboot m ode when the aprom program can not run properly and device can not jump back to ldrom to execut e in-system programming function. then you can use this f04kboot mode to force the w78e 058b jumps to ldrom and executes in-system programming procedure. when you design your syste m, you may reserve the pins p2.6, p2.7 to switches or jumpers. for example in a cd-rom system, you can connect the p2.6 and p2.7 to play and eject buttons on the panel. when the aprom progr am fails to execute the normal application program. user can press both two buttons at t he same time and then turn on the power of the personal computer to force the w78e058b to enter the f04kboot mode. after power on of personal computer, you can release both buttons and fini sh the in-system programming procedure to update the aprom code. in application system design, user must take care of the p2, p3, ale, ea and psen pin value at reset to prevent from accidenta lly activating the programming mode or f04kboot mode.
w78e58b/w78e058b - 16 - f04kboot mode p4.3 p2.7 p2.6 mode x l l fo4kboot l x x fo4kboot p2.7 p2.6 rst 30 ms hi-z the reset timing for entering f04kboot mode 10 ms hi-z
w78e58b/w78e058b publication release date: december 4, 2006 - 17 - revision a8 start the al g orithm of in-s y stem pro g rammin g enter in-system programming mode ? (conditions depend on user's application) setting control registers mov chpenr,#87h mov chpenr,#59h mov chpcon,#03h setting timer (about 1.5 us) and enable timer interrupt start timer and enter idle mode. (cpu will be wakened from idle mode by timer interrupt, then enter in-system programming mode) execute the normal application program no yes end cpu will be wakened by interrupt and re-boot from 4kb ldrom to execute the loader program. go part 1:32kb aprom procedure of entering in-system programming mode
w78e58b/w78e058b - 18 - part 2: 4kb ldrom procedure of updating the 32kb aprom go timer interrupt service routine: stop timer & disable interrupt is f04kboot mode? (chpcon.7=1) reset the chpcon register: mov chpenr,#87h mov chpenr,#59h mov chpcon,#03h no yes setting timer and enable timer interrupt for wake-up . (15 ms for erasing operation) setting erase operation mode: mov sfrcn,#22h (erase 32kb aprom) start timer and enter idle mode. (erasing...) end of erase operation. cpu will be wakened by timer interrupt. pgm pgm setting timer and enable timer interrupt for wake-up . (50us for program operation) end of programming ? get the parameters of new code (address and data bytes) through i/o ports, uart or other interfaces. is currently in the f04kboot mode ? setting control registers for programming: mov sfrah,#address_h mov sfral,#address_l mov sfrfd,#data mov sfrcn,#21h software reset cpu and re-boot from the 32kb aprom. mov chpenr,#87h mov chpenr,#59h mov chpcon,#83h end executing new code from address 00h in the 32kb aprom. hardware reset to re-boot from new 32 kb aprom. (s/w reset is invalid in f04kboot mode) yes no yes no
w78e58b/w78e058b publication release date: december 4, 2006 - 19 - revision a8 6. security during the on-chip rom programming mode, the rom can be programmed and verified repeatedly. until the code inside the rom is confirmed ok, t he code can be protected. the protection of rom and those operations on it are described below. the w78e058b has a security register that can be accessed in programming mode. those bits of the security registers can not be changed once they have been programmed from high to low. they can only be reset through erase-all operation. the secu rity register is located at the 0ffffh of the ldrom space. b0 b1 b0: lock bit, logic 0: active b1: movc inhibit, logic 0: the movc instruction in external memory cannot access the code in internal memory. logic 1: no restriction. default 1 for all security bits. s p ecial settin g re g ister security bits 4kb on-chip rom program memory reserved security register ffffh 0000h 0fffh reserved b2 b2: encryption logic 0: the encryption logic enable logic 1: the encryption logic disable reserved bits must be kept in logic 1. b7 b07: osillator control logic 0: 1/2 gain logic 1: full gain ldrom reserved 32kb on-chip rom program memory aprom 7fffh 6.1 lock bit this bit is used to protect the customer's pr ogram code in the w78e058b. it may be set after the programmer finishes the programming and verifies sequenc e. once this bit is set to logic 0, both the rom data and security register can not be accessed again. 6.2 movc inhibit this bit is used to restrict the accessible region of the movc instruction. it can prevent the movc instruction in external program memory from reading the internal program code. when this bit is set to logic 0, a movc instruction in external program memory space will be able to access code only in the external memory, not in the internal memory. a mo vc instruction in internal program memory space will always be able to access the rom data in both internal and external memory. if this bit is logic 1, there are no restrictions on the movc instruction.
w78e58b/w78e058b - 20 - 6.3 encryption this bit is used to enable/disable the encryption logi c for code protection. once encryption feature is enabled, the data presented on port 0 will be encoded via enc ryption logic. only whole chip erase will reset this bit. 6.4 oscillator control w78e058b/e516 allow user to diminish the gain of on- chip oscillator amplifier by using programmer to set the bit b7 of security register. once b7 is se t to 0, a half of gain will be decreased. care must be taken if user attempts to diminish the gain of oscillator amplifier, reducing a half of gain may improperly affect the external crystal operati on at high frequency above 24 mhz. the value of r and c1, c2 may need some adjustment while running at lower gain.
w78e58b/w78e058b publication release date: december 4, 2006 - 21 - revision a8 7. electrical characteristics 7.1 absolute maximum ratings parameter symbol min. max. unit dc power supply v dd ? v ss -0.3 +6.0 v input voltage v in v ss -0.3 v dd +0.3 v operating temperature t a 0 70 c storage temperature t st -55 +150 c note: exposure to conditions beyond those listed under absolute ma ximum ratings may adversely affect the life and reliability of the device. 7.2 d.c. characteristics (vdd ? vss = 5v 10%, ta = 25 c, fosc = 20 mhz, unless otherwise specified.) specification parameter sym. min. max. unit test conditions operating voltage v dd 4.5 5.5 v rst = 1, p0 = v dd operating current i dd - 20 ma no load v dd = 5.5v idle current i idle - 6 ma idle mode v dd = 5.5v power down current i pwdn - 50 a power-down mode v dd = 5.5v input current p1, p2, p3, p4 i in1 -50 +10 a v dd = 5.5v v in = 0v or v dd input current rst i in2 -10 +300 a v dd = 5.5v 0v < v in < v dd input leakage current p0, ea i lk -10 +10 a v dd = 5.5v 0v < v in < v dd logic 1 to 0 transition current p1, p2, p3, p4 i tl [*4] -500 - a v dd = 5.5v v in = 2.0v input low voltage p0, p1, p2, p3, p4, e a vil1 0 0.8 v vdd = 4.5v input low voltage rst v il2 0 0.8 v vdd = 4.5v
w78e58b/w78e058b - 22 - d.c. characteristics, continued specification parameter sym. min. max. unit test conditions input low voltage xtal1 [*4] v il3 0 0.8 v v dd = 4.5v input high voltage p0, p1, p2, p3, p4, e a v ih1 2.4 v dd +0.2 v v dd = 5.5v input high voltage rst v ih2 3.5 v dd +0.2 v v dd = 5.5v input high voltage xtal1 [*4] v ih3 3.5 v dd +0.2 v v dd = 5.5v output low voltage p1, p2, p3, p4 v ol1 - 0.45 v v dd = 4.5v i ol = +2 ma output low voltage p0, ale, psen [*3] v ol2 - 0.45 v v dd = 4.5v i ol = +4 ma sink current p1, p3, p4 isk1 4 12 ma v dd = 4.5v v in = 0.45v sink current p0, p2, ale, psen isk2 10 20 ma v dd = 4.5v v in = 0.45v output high voltage p1, p2, p3, p4 v oh1 2.4 - v v dd = 4.5v i oh = -100 a output high voltage p0, ale, psen [*3] v oh2 2.4 - v v dd = 4.5v i oh = -400 a source current p1, p2, p3, p4 isr1 -120 -250 a v dd = 4.5v v in = 2.4v source current p0, p2, ale, psen isr2 -8 -20 ma v dd = 4.5v v in = 2.4v notes: *1. rst pin is a schmitt trigger input. *2. p0, ale and psen are tested in the external access mode. *3. xtal1 is a cmos input. *4. pins of p1, p2, p3, p4 can source a transition curr ent when they are being externally driven from 1 to 0.
w78e58b/w78e058b publication release date: december 4, 2006 - 23 - revision a8 7.3 a.c. characteristics the ac specifications are a function of the par ticular process used to manufacture the part, the ratings of the i/o buffers, the capacitive load, and the internal routing capacitance. most of the specifications can be expressed in term s of multiple input clock periods (t cp ), and actual parts will usually experience less than a 20 ns variation. the numbers below represent the performance expected from a 0.6 micron cmos proce ss when using 2 and 4 ma output buffers. 7.3.1 clock input waveform t t xtal1 f ch cl op, t cp parameter symbol min. typ. max. unit notes operating speed f op 0 - 40 mhz 1 clock period t cp 25 - - ns 2 clock high t ch 10 - - ns 3 clock low t cl 10 - - ns 3 notes: 1. the clock may be stopped indefinitely in either state. 2. the t cp specification is used as a refe rence in other specifications. 3. there are no duty cycle requirements on the xtal1 input. 7.3.2 program fetch cycle parameter symbol min. typ. max. unit notes address valid to ale low t aas 1 t cp - ? - - ns 4 address hold from ale low t aah 1 t cp - ? - - ns 1, 4 ale low to psen low t apl 1 t cp - ? - - ns 4 psen low to data valid t pda - - 2 t cp ns 2 data hold after psen high t pdh 0 - 1 t cp ns 3 data float after psen high t pdz 0 - 1 t cp ns ale pulse width t alw 2 t cp - ? 2 t cp - ns 4 psen pulse width t psw 3 t cp - ? 3 t cp - ns 4 notes: 1. p0.0 ? p0.7, p2.0 ? p2.7 remain stable throughout entire memory cycle. 2. memory access time is 3 t cp . 3. data have been latched internally prior to psen going high. 4. " ? " (due to buffer driving delay and wire loading) is 20 ns.
w78e58b/w78e058b - 24 - 7.3.3 data read cycle parameter symbol min. typ. max. unit notes ale low to rd low t dar 3 t cp - ? - 3 t cp+ ? ns 1, 2 rd low to data valid t dda - - 4 t cp ns 1 data hold from rd high t ddh 0 - 2 t cp ns data float from rd high t ddz 0 - 2 t cp ns rd pulse width t drd 6 t cp - ? 6 t cp - ns 2 notes: 1. data memory access time is 8 t cp . 2. " ? " (due to buffer driving delay and wire loading) is 20 ns. 7.3.4 data write cycle parameter symbol min. typ. max. unit ale low to wr low t daw 3 t cp - ? - 3 t cp + ? ns data valid to wr low t dad 1 t cp - ? - - ns data hold from wr high t dwd 1 t cp - ? - - ns wr pulse width t dwr 6 t cp - ? 6 t cp - ns note: " ? " (due to buffer driving delay and wire loading) is 20 ns. 7.3.5 port access cycle parameter symbol min. typ. max. unit port input setup to ale low t pds 1 tcp - - ns port input hold from ale low t pdh 0 - - ns port output to ale t pda 1 tcp - - ns note: ports are read during s5p2, and output data becomes available at the end of s6p2. the timing data are referenced to ale, since it provides a convenient reference.
w78e58b/w78e058b publication release date: december 4, 2006 - 25 - revision a8 8. timing waveforms 8.1 program fetch cycle s1 xtal1 s2 s3 s4 s5 s6 s1 s2 s3 s4 s5 s6 ale port 2 a0-a7 a0-a7 data a0-a7 code t a0-a7 data code port 0 psen pdh, t pdz t pda t aah t aas t psw t apl t alw 8.2 data read cycle s2 s3 s5 s6 s1 s2 s3 s4 s5 s6 s1 s4 xtal1 ale psen data a8-a15 port 2 port 0 a0-a7 rd t ddh, t ddz t dda t drd t dar
w78e58b/w78e058b - 26 - 8.3 data write cycle s2 s3 s5 s6 s1 s2 s3 s4 s1 s5 s6 s4 xtal1 ale psen a8-a15 data out port 2 port 0 a0-a7 wr t t daw dad t dwr t dwd 8.4 port access cycle xtal1 ale s5 s6 s1 data out t t port input t sample pda pdh pds
w78e58b/w78e058b publication release date: december 4, 2006 - 27 - revision a8 9. typical application circuits 9.1 expanded external program memory and crystal ad0 a0 a0 a0 10 a1 9 a2 8 a3 7 a4 6 a5 5 a6 4 a7 3 a8 25 a9 24 a10 21 a11 23 a12 2 a13 26 a14 27 a15 1 ce 20 oe 22 o0 11 o1 12 o2 13 o3 15 o4 16 o5 17 o6 18 o7 19 27512 ad0 d0 3 q0 2 d1 4 q1 5 d2 7 q2 6 d3 8 q3 9 d4 13 q4 12 d5 14 q5 15 d6 17 q6 16 d7 18 q7 19 oc 1 g 11 74ls373 ad0 ea 31 xtal1 19 xtal2 18 rst 9 int0 12 int1 13 t0 14 t1 15 p1.0 1 p1.1 2 p1.2 3 p1.3 4 p1.4 5 p1.5 6 p1.6 7 p1.7 8 39 38 37 36 35 34 33 32 21 22 23 24 25 26 27 28 17 wr p0.0 p0.1 p0.2 p0.3 p0.4 p0.5 p0.6 p0.7 p2.0 p2.1 p2.2 p2.3 p2.4 p2.5 p2.6 p2.7 rd 16 psen 29 ale 30 txd 11 rxd 10 w78e58b/w78e058b 10 u 8.2 k v crystal c1 c2 r ad1 ad2 ad3 ad4 ad5 ad6 ad7 a8 ad1 ad2 ad3 ad4 ad5 ad6 ad7 gnd a1 a2 a3 a4 a5 a6 a7 a1 a2 a3 a4 a5 a6 a7 a8 a9 ad1 ad2 ad3 ad4 ad5 ad6 ad7 a10 a11 a12 a13 a14 a15 gnd a9 a10 a11 a12 a13 a14 a15 dd figure a crystal c1 c2 r 6 mhz 47p 47p - 16 mhz 30p 30p - 24 mhz 15p 10p - 40mhz 5p 5p 6.8k above table shows the reference values for crystal applications. notes: 1. c1, c2, r components refer to figure a 2. crystal layout must get close to xta l1 and xtal2 pins on user's application board.
w78e58b/w78e058b - 28 - 9.2 expanded external data memory and oscillator 10 u 8.2 k oscillator ea 31 xtal1 19 xtal2 18 rst 9 int0 12 int1 13 t0 14 t1 15 p1.0 1 p1.1 2 p1.2 3 p1.3 4 p1.4 5 p1.5 6 p1.6 7 p1.7 8 p0.0 39 p0.1 38 p0.2 37 p0.3 36 p0.4 35 p0.5 34 p0.6 33 p0.7 32 p2.0 21 p2.1 22 p2.2 23 p2.3 24 p2.4 25 p2.5 26 p2.6 27 p2.7 28 rd 17 wr 16 psen 29 ale 30 txd 11 rxd 10 w78e58b/w78e058b ad0 ad1 ad2 ad3 ad4 ad5 ad6 ad7 ad0 ad1 ad2 ad3 ad4 ad5 ad6 ad7 a0 a1 a2 a3 a4 a5 a6 a7 d0 3 q0 2 d1 4 q1 5 d2 7 q2 6 d3 8 q3 9 d4 13 q4 12 d5 14 q5 15 d6 17 q6 16 d7 18 q7 19 oc 1 g 11 74ls373 a0 a1 a2 a3 a4 a5 a6 a7 10 9 8 7 6 5 4 3 a0 a1 a2 a3 a4 a5 a6 a7 ad0 ad1 ad2 ad3 ad4 ad5 ad6 ad7 11 12 13 15 16 17 18 19 d0 d1 d2 d3 d4 d5 d6 d7 a8 a9 a10 a11 a12 a13 a14 25 24 21 23 26 1 20 2 a8 a9 a10 a11 a12 a13 a14 ce gnd a8 a9 a10 a11 a12 a13 a14 gnd 22 27 oe wr 20256 v dd v dd figure b
w78e58b/w78e058b publication release date: december 4, 2006 - 29 - revision a8 10. package dimensions 10.1 40-pin dip seating plane 1. dimension d max. & s include mold flash or tie bar burrs. 2. dimension e1 does not include interlead flash. 3. dimension d & e1 include mold mismatch and are determined at the mold parting line. 6. general appearance spec. should be based on final visual inspection spec. . 1.372 1.219 0.054 0.048 notes: symbol min. nom. max. max. nom. min. dimension in inchdimension in mm 0.050 1.27 0.210 5.334 0.010 0.150 0.016 0.155 0.018 0.160 0.022 3.81 0.406 0.254 3.937 0.457 4.064 0.559 0.008 0.120 0.670 0.010 0.130 0.014 0.140 0.203 3.048 0.254 3.302 0.356 3.556 0.540 0.550 0.545 13.72 13.97 13.84 17.01 15.24 14.986 15.494 0.600 0.590 0.610 2.286 2.54 2.794 0.090 0.100 0.110 a b c d e a l s a a 1 2 e b 1 1 e e 1 a 2.055 2.070 52.20 52.58 015 0.090 2.286 0.650 0.630 16.00 16.51 protrusion/intrusion. 4. dimension b1 does not include dambar 5. controlling dimension: inches. 15 0 e a a a c e base plane 1 a 1 e l a s 1 e d 1 b b 40 21 20 1 2 10.2 44-pin plcc 44 40 39 29 28 18 17 7 61 l c 1 b 2 a h d d e b e h e y a a 1 seating plane d g g e symbol min. nom. max. max. nom. min. dimension in inch dimension in mm a b c d e h e l y a a 1 2 e b 1 h d g g d e notes: on final visual inspection spec. 4. general appearance spec. should be based 3. controlling dimension: inches protrusion/intrusion. 2. dimension b1 does not include dambar flash. 1. dimension d & e do not include interlead 0.020 0.145 0.026 0.016 0.008 0.648 0.590 0.680 0.090 0.150 0.028 0.018 0.010 0.653 0.610 0.690 0.100 0.050 bsc 0.185 0.155 0.032 0.022 0.014 0.658 0.630 0.700 0.110 0.004 0.508 3.683 0.66 0.406 0.203 16.46 14.99 17.27 2.296 3.81 0.711 0.457 0.254 16.59 15.49 17.53 2.54 1.27 4.699 3.937 0.813 0.559 0.356 16.71 16.00 17.78 2.794 0.10 bsc 16.71 16.59 16.46 0.658 0.653 0.648 16.00 15.49 14.99 0.630 0.610 0.590 17.78 17.53 17.27 0.700 0.690 0.680
w78e58b/w78e058b - 30 - 10.3 44-pin pqfp seating plane 11 22 12 see detail f e b a y 1 a a l l 1 c e e h 1 d 44 h d 34 33 detail f 1. dimension d & e do not include interlead flash. 2. dimension b does not include dambar protrusion/intrusion. 3. controlling dimension: millimeter 4. general appearance spec. should be based on final visual inspection spec. 0.254 0.101 0.010 0.004 notes: symbol min. nom. max. max. nom. min. dimension in inch dimension in mm a b c d e h d h e l y a a l 1 1 2 e 0.006 0.152 --- 0.002 0.075 0.01 0.081 0.014 0.087 0.018 1.90 0.25 0.05 2.05 0.35 2.20 0.45 0.390 0.025 0.063 0.003 0 7 0.394 0.031 0.398 0.037 9.9 0.80 0.65 1.6 10.00 0.8 10.1 0.95 0.398 0.394 0.390 0.530 0.520 0.510 13.45 13.2 12.95 10.1 10.00 9.9 7 0 0.08 0.031 0.01 0.02 0.25 0.5 --- --- --- --- --- 2 0.025 0.036 0.635 0.952 0.530 0.520 0.510 13.45 13.2 12.95 0.051 0.075 1.295 1.905
w78e58b/w78e058b publication release date: december 4, 2006 - 31 - revision a8 11. application notes 11.1 in-system programming software examples this application note illustrates the in-syste m programmability of the winbond w78e058b rom microcontroller. in this example, microcontrolle r will boot from 32kb aprom bank and waiting for a key to enter in-system programming mode for re -programming the contents of 32kb aprom. while entering in-system programming mode, microcontrolle r executes the loader program in 4kb ldrom bank. the loader program erases the 32kb aprom then reads the new code data from external sram buffer (or through other interfaces) to update the 32kb aprom. example 1: ;******************************************************************************************************************* ;* example of 32k aprom program: program will scan the p1.0. if p1.0 = 0, enters in-system ;* programming mode for updating the content of apr om code else executes the current rom code. ;* xtal = 16 mhz ;******************************************************************************************************************* .chip 8052 .ramchk off .symbols chpcon equ bfh chpenr equ f6h sfral equ c4h sfrah equ c5h sfrfd equ c6h sfrcn equ c7h org 0h ljmp 100h ; jump to main program ; ************************************************************************ ;* timer0 service vector org = 000bh ;************************************************************************ org 00bh clr tr0 ; tr0 = 0, stop timer0 mov tl0, r6 mov th0, r7 reti ;************************************************************************ ;* 32k aprom main program ;************************************************************************ org 100h main_32k: mov a, p1 ; scan p1.0 anl a, #01h cjne a, #01h, program_32k; if p1 .0 = 0, enter in-system programming mode jmp normal_mode program_32k: mov chpenr, #87h ; chpenr = 87h, chpcon register wrte enable mov chpenr, #59h ; chpenr = 59h, chpcon register write enable mov chpcon, #03h ; chpcon = 03h, enter in-system programming mode
w78e58b/w78e058b - 32 - mov tcon, #00h ; tr = 0 timer0 stop mov ip, #00h ; ip = 00h mov ie, #82h ; time r0 interrupt enable for wake-up from idle mode mov r6, #f0h ; tl0 = f0h mov r7, #ffh ; th0 = ffh mov tl0, r6 mov th0, r7 mov tmod, #01h ; tmod = 01h, set timer0 a 16-bit timer mov tcon, #10h ; tcon = 10h, tr0 = 1, go mov pcon, #01h ; enter idle mode for launching the in-system ; programming ;******************************************************************************** ;* normal mode 32kb aprom program: depending user's application ;******************************************************************************** normal_mode: . ; user's application program . . . example 2: ;****************************************************************************************************************************** example of 4 kb ldrom program: this loader program will erase the 32kb aprom first, then reads the new ;* code from external sram and program them into 32 kb aprom bank. xtal = 16 mhz ;***************************************************************************************************************************** .chip 8052 .ramchk off .symbols chpcon equ bfh chpenr equ f6h sfral equ c4h sfrah equ c5h sfrfd equ c6h sfrcn equ c7h org 000h ljmp 100h ; jump to main program ; ************************************************************************ ;* 1. timer0 service vector org = 0bh ;************************************************************************ org 000bh clr tr0 ; tr0 = 0, stop timer0 mov tl0, r6 mov th0, r7 reti ;************************************************************************ ;* 4kb ldrom main program ;************************************************************************ org 100h
w78e58b/w78e058b publication release date: december 4, 2006 - 33 - revision a8 main_4k: mov sp, #c0h mov chpenr, #87h ; chpenr = 87h, chpcon write enable. mov chpenr, #59h ; chpenr = 59h, chpcon write enable. mov a, chpcon anl a, #80h cjne a, #80h, update_32k ; check f04kboot mode ? mov chpcon, #03h ; chp con = 03h, enable in-system programming. mov chpenr, #00h ; disable chpcon write attribute mov tcon, #00h ; tcon = 00h, tr = 0 timer0 stop mov tmod, #01h ; tmod = 01h, set timer0 a 16bit timer mov ip, #00h ; ip = 00h mov ie, #82h ; ie = 82h, timer0 interrupt enabled mov r6, #f0h mov r7, #ffh mov tl0, r6 mov th0, r7 mov tcon, #10h ; tcon = 10h, tr0 = 1, go mov pcon, #01h ; enter idle mode update_32k: mov chpenr, #00h ; disable chpcon write-attribute mov tcon, #00h ; tcon = 00h , tr = 0 tim0 stop mov ip, #00h ; ip = 00h mov ie, #82h ; ie = 82h, timer0 interrupt enabled mov tmod, #01h ; tmod = 01h, mode1 mov r6, #e0h ; set wake-up time for erase operation, about 15 ms. depending ; on user's system clock rate. mov r7, #b1h mov tl0, r6 mov th0, r7 erase_p_4k: mov sfrcn, #22h ; sfrcn(c7h) = 22h erase 32k mov tcon, #10h ; tcon = 10h, tr0 = 1,go mov pcon, #01h ; en ter idle mode (for erase operation) ;********************************************************************* ;* blank check ;********************************************************************* mov sfrcn, #0h ; read 32kb aprom mode mov sfrah, #0h ; start address = 0h mov sfral, #0h mov r6, #feh ; set timer for read operation, about 1.5 s. mov r7, #ffh mov tl0, r6 mov th0, r7 blank_check_loop: setb tr0 ; enable timer 0 mov pcon, #01h ; enter idle mode mov a, sfrfd ; read one byte cjne a, #ffh, blank_check_error
w78e58b/w78e058b - 34 - inc sfral ; next address mov a, sfral jnz blank_check_loop inc sfrah mov a, sfrah cjne a, #80h, blank_check_loop ; end address = 7fffh jmp program_32krom blank_check_error: mov p1, #f0h mov p3, #f0h jmp $ ;******************************************************************************* ;* re-programming 32kb aprom bank ;******************************************************************************* program_32krom: mov dptr, #0h ; the address of new rom code mov r2, #00h ; target low byte address mov r1, #00h ; target high byte address mov dptr, #0h ; external sram buffer address mov sfrah, r1 ; sfrah, target high address mov sfrcn, #21h ; sfrcn(c7h) = 21 (program 32k) mov r6, #beh ; set timer for programming, about 50 s. mov r7, #ffh mov tl0, r6 mov th0, r7 prog_d_32k: mov sfral, r2 ; sfral(c4h) = low byte address movx a, @dptr ; read data from external sram buffer. by according user? ; circuit, user must modify this instruction to fetch code mov sfrfd, a ; sfrfd(c6h) = data in mov tcon, #10h ; tcon = 10h, tr0 = 1,go mov pcon, #01h ; enter idle mode (prorgamming) inc dptr inc r2 cjne r2, #0h, prog_d_32k inc r1 mov sfrah, r1 cjne r1, #80h, prog_d_32k ;***************************************************************************** ; * verify 32kb aprom bank ;***************************************************************************** mov r4, #03h ; error counter mov r6, #feh ; set timer for read verify, about 1.5 s. mov r7, #ffh mov tl0, r6 mov th0, r7 mov dptr, #0h ; the start address of sample code mov r2, #0h ; target low byte address mov r1, #0h ; target high byte address mov sfrah, r1 ; sfrah, target high address mov sfrcn, #00h ; sfrcn = 00 (read rom code)
w78e58b/w78e058b publication release date: december 4, 2006 - 35 - revision a8 read_verify_32k: mov sfral, r2 ; sfral(c4h) = low address mov tcon, #10h ; tcon = 10h, tr0 = 1,go mov pcon, #01h inc r2 movx a, @dptr inc dptr cjne a, sfrfd, error_32k cjne r2, #0h, read_verify_32k inc r1 mov sfrah, r1 cjne r1, #80h, read_verify_32k ;****************************************************************************** ;* programming completly, software reset cpu ;****************************************************************************** mov chpenr, #87h ; chpenr = 87h mov chpenr, #59h ; chpenr = 59h mov chpcon, #83h ; chpcon = 83h, software reset. error_32k: djnz r4, update_32k ; if error occurs, repeat 3 times. . ; in-system programming fail, user's process to deal with it. . . .
w78e58b/w78e058b - 36 - 12. revision history version date page description a3 march, 2002 - formerly issued a4 june, 2004 2 revise part number in the item of packages a5 april 20, 2005 34 add important notice a6 june 7, 2005 3 add lead free (rohs) parts a7 october 3, 2006 remove block diagram a8 december 4, 2006 3 remove all leaded package parts important notice winbond products are not designed, intended, authorized or warranted for use as components in systems or equipment intended for surgi cal implantation, atomic energy control instruments, airplane or spaceship instrument s, transportation instruments, traffic signal instruments, combustion control instruments, or for other applications intended to support or sustain life. further more, winbond products are not intended for applications wherein failure of winbond products could result or lead to a situation wherein personal injury, death or severe property or environmental damage could occur. winbond customers using or selling these products for use in such applications do so at their own risk and agree to fully indemnify winbond for any damages resulting from such improper use or sales. headquarters no. 4, creation rd. iii, science-based industrial park, hsinchu, taiwan tel: 886-3-5770066 fax: 886-3-5665577 http://www.winbond.com.tw/ taipei office tel: 886-2-8177-7168 fax: 886-2-8751-3579 winbond electronics corporation america 2727 north first street, san jose, ca 95134, u.s.a. tel: 1-408-9436666 fax: 1-408-5441798 winbond electronics (h.k.) ltd. no. 378 kwun tong rd., kowloon, hong kong fax: 852-27552064 unit 9-15, 22f, millennium city, tel: 852-27513100 please note that all data and specifications are subject to change without notice. all the trademarks of products and companies mentioned in this datasheet belong to their respective owners. winbond electronics (shanghai) ltd. 200336 china fax: 86-21-62365998 27f, 2299 yan an w. rd. shanghai, tel: 86-21-62365999 winbond electronics corporation japan shinyokohama kohoku-ku, yokohama, 222-0033 fax: 81-45-4781800 7f daini-ueno bldg, 3-7-18 tel: 81-45-4781881 9f, no.480, rueiguang rd., neihu district, taipei, 114, taiwan, r.o.c.


▲Up To Search▲   

 
Price & Availability of W78E058B40PL

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X